import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)
import layout from '../views/layout.vue'
import articleDetail from '../views/article-detail.vue'
import article from '../views/article.vue'
import collect from '../views/collect.vue'
import like from '../views/like.vue'
import user from '../views/user.vue'


const router = new VueRouter({
  routes: [
    {
      path: '/',
      component: layout,
      //二级路由,子路由,路由的嵌套
      children: [{
        //一般不带/意思就是匹配时会拼上父路由path
        //例如此处表示匹配/article
        path: 'article',
        component: article
      },
      {
        path: 'collect',
        component: collect
      },
      {
        path: 'like',
        component: like
      },
      {
        path: 'user',
        component: user
      }
      ]
    },
    {
      //修改路由器接收参数
      path: '/detail/:id',
      component: articleDetail
    },

  ]
})

export default router